import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.*;

/**
 * Created by miaoxie on 2017/3/13.
 */
public class Main {
    WebDriver webdriver;
    List<WebElement> bt;
    public static void main(String []args){
//        System.setProperty("webdriver.ie.driver", "util/IEDriverServer.exe");
//        DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
//        ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
//        WebDriver driver = new InternetExplorerDriver(ieCapabilities);
//        driver.get("http://hr.deppon.com:9080/eos-default/dip.integrateorg.oaAttence.oaAttence.flow");
//        try {
//            Thread.sleep(3000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        WebElement username = driver.findElement(By.id("code"));
//        username.clear();
//        username.sendKeys("aaaa");
        new Main().init();

    }

    private void offduty(){

    }

    private void onduty(){

    }

    private void init(){


        String driverLoc = "util/chromedriver.exe";
        String driver = "webdriver.chrome.driver";

        System.setProperty(driver, driverLoc);
        webdriver = new ChromeDriver();
        webdriver.get("http://wap.jue-huo.com/app/html/game/1to50/1to50.html");
        JavascriptExecutor js=(JavascriptExecutor)webdriver;
        Map<Integer,WebElement> bt2 = new HashMap<Integer, WebElement>();
        Map<Integer,WebElement> bt3 = new HashMap<Integer, WebElement>();
        initEliment();
            for(WebElement w : bt){
                String a = w.getAttribute("innerHTML");
                a = a.substring(a.lastIndexOf('>')+1,a.length());
                    bt2.put(Integer.valueOf(a),w);
                    continue;
            }


        int j = 0;
        for(int i = 1;i<=25;i++){
                WebElement w = bt2.get(i);
                w.click();
        }
        initEliment();
        for(WebElement w : bt){
            String a = w.getAttribute("innerHTML");
            a = a.substring(a.lastIndexOf('>')+1,a.length());
            bt3.put(Integer.valueOf(a),w);
            continue;
        }
        for(int i = 1;i<=25;i++){
            WebElement w = bt3.get(i+25);
            w.click();
        }

    }
    private void initEliment(){
        bt = webdriver.findElements(By.cssSelector("#grid > div"));
        System.out.printf("aaaa");
    }


}
